package com.ccl.keyassistant.utils;



import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.view.View;

public class AnimationUtils {
    /**
     * 菜单动画
     * @param view 要实现动画的控件
     * @param delay 动画延迟
     * @param start 竖直平移的起点
     * @param end 竖直平移的终点
     */
    public static void menuAnimation(View view,long delay,float start,float end){
        //竖直动画
        ObjectAnimator translationY = ObjectAnimator.ofFloat(
                view,"translationY",start,end
        );

        //设置竖直和水平方向上的放大与缩小
        ObjectAnimator scaleY = ObjectAnimator.ofFloat(view, "scaleY", 1f, 5f, 1f);
        ObjectAnimator scaleX = ObjectAnimator.ofFloat(view, "scaleX", 1f, 5f, 1f);

        //设置动画效果叠加
        AnimatorSet aSet = new AnimatorSet();
        aSet.setDuration(300);
        aSet.setStartDelay(delay);
        aSet.playTogether(translationY,scaleY,scaleX);
    }
}
